package com.pj.fantabestconsole.client.mvc;

import com.extjs.gxt.ui.client.event.EventType;
import com.extjs.gxt.ui.client.mvc.AppEvent;
import com.extjs.gxt.ui.client.mvc.Controller;
import com.pj.fantabestconsole.client.ConsoleEvents;

public class ConsoleController extends Controller {

	private ConsoleView consoleView;
	
	public ConsoleController() {
		super();
		registerEventTypes(ConsoleEvents.Init);
		registerEventTypes(ConsoleEvents.Login);
		registerEventTypes(ConsoleEvents.Logoff);
	}

	@Override
	public void handleEvent(AppEvent event) {
	    EventType type = event.getType();
	    if (type == ConsoleEvents.Init) {
	    	forwardToView(consoleView, event);
	    } else if (type == ConsoleEvents.Login) {
	    	forwardToView(consoleView, event);
	    } else if (type == ConsoleEvents.Logoff) {
	    	forwardToView(consoleView, event);
	    } else if (type == ConsoleEvents.Error) {
	    }		
	}
	
	@Override
	protected void initialize() {
		super.initialize();
		consoleView = new ConsoleView(this);
	}

}

